package com.ocom.payhandle.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ocom.common.entity.payconfig.EntityDishesPoint;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface IDaoDishesPoint extends BaseMapper<EntityDishesPoint> {

    /**
     * select 	P.point_id as restPoint , X.point_orgin
     * 			from 	dishes_point as P , xf_point_info as X
     * where 	P.com_id = @comId 	and 	P.point_id in ( @pointOrg ) 	and 	X.point_id = P.point_id
     * 			order by 	X.point_orgin 	desc	limit 1
     * @param comId
     * @param pointOrg
     * @return
     */
//    @Select({"<script>",
//               "select P.point_id as restPoint , X.point_orgin as pointOrgin \n" +
//                       "FROM dishes_point P \n" +
//                       "INNER JOIN xf_point_info X ON X.point_id = P.point_id \n"+
//                       "where P.com_id=#{comId} "+
//                       "and P.point_id in ( #{pointOrg} ) "+
//                       "order by X.point_orgin desc  limit 1",
//            "</script>"})
//    DishesPointOrgVo selectPoint(@Param("comId") Long comId, @Param("pointOrg")String pointOrg);


    /**
     * 分库6.1.15菜品摆放表dishes_point查询数据数据DISH：
     * select 	P.dishes_point , X.point_name as pointName , X.point_orgin ,
     * P.dishes_id , D.dishes_name as dishesName , D.photo_url as photoUrl
     * 			from 	dishes_point as P , xf_point_info as X , dishes_info as D
     * where 	P.com_id = @comId 	and 	P.point_id = @restPoint 	and 	P.dishes_id= D.dishes_id
     * 					and 	P.meal_date = @lastDate 	and 	P.meal_no= @mealNo 	and 	P.dishes_point= X.point_id
     * 					and (P.dishes_point = @pointId  	or 	X. point_orgin like “@thisOrg%” )
     * 			order by 	X.parent_point_id , P.dishes_point
     */
//    @Select({"<script>",
//            "select  P.dishes_point , X.point_name as pointName , X.point_orgin ,  \n" +
//                    "P.dishes_id , D.dishes_name as dishesName , D.photo_url as photoUrl  \n" +
//                    "from  dishes_point as P , xf_point_info as X , dishes_info as D \n" +
//                    "where  P.com_id =#{comId}  and  P.point_id = #{restPoint}  and  P.dishes_id= D.dishes_id \n"+
//                    "and  P.meal_date = #{lastDate}  and  P.meal_no= #{mealNo}  and  P.dishes_point= X.point_id "+
//                    "and   X. point_orgin is not null   "+
//                    "and (P.dishes_point = #{pointId} "+
//                    " <when test=\"thisOrg.size()>0 \" > "+
//                    "or  " +
//                    "<foreach collection='thisOrg' item='item' open='( ' separator='or' close=')'>" +
//                    "  X. point_orgin like   concat('%', #{item}, '%')    " +
//                    "</foreach>"+
//                    " </when> "+
//                    ")" +
//                    "order by  X.parent_point_id , P.dishes_point",
//            "</script>"})
//    List<DishesPointListVo>  selectPointDishes(@Param("comId") Long comId,
//                                               @Param("restPoint")Integer restPoint,
//                                               @Param("lastDate") Date lastDate,
//                                               @Param("mealNo")Integer mealNo,
//                                               @Param("pointId")Integer pointId,
//                                               @Param("thisOrg") List<Integer> thisOrg
//
//    );


}
